home *** CD-ROM | disk | FTP | other *** search
/ Macwelt 1 / Macwelt DVD 1.toast / Web-Publishing / HTML-Editoren / Alpha ƒ / Mode Examples / SAS-Example.sas < prev    next >
Encoding:
Text File  |  2000-10-30  |  14.8 KB  |  422 lines

  1. /* -*-SAS-*- 
  2.  * ==========================================================================
  3.  * SAS-Example.sas
  4.  * 
  5.  * Distributed as an example of Alpha's SAS mode.
  6.  * 
  7.  * SAS mode is available in the Statistical Modes package at
  8.  * 
  9.  * <ftp://ftp.ucsd.edu/pub/alpha/>
  10.  * ==========================================================================
  11.  */
  12.  
  13. /* 
  14.  * ==========================================================================
  15.  *  SPPA Analysis - Exploring 15 year trends in Participation in the Arts
  16.  *  
  17.  *  FILE: "sppa1982.sas"
  18.  *                                    created: 11/14/98 {02:34:21 pm} 
  19.  *                                last update: 05/29/00 {06:38:55 pm} 
  20.  *  Description: 
  21.  * 
  22.  *  Reading data from the CD-ROM "SPPA" -- National Endowment of the Arts. 
  23.  *  A revision of Steven Tepper's tap82.sas
  24.  * 
  25.  *  Author: Craig Barton Upright
  26.  *  E-mail: <cupright@princeton.edu>
  27.  *    mail: Princeton University, Department of Sociology
  28.  *          Princeton, New Jersey 08544
  29.  *     www: <http://www.princeton.edu/~cupright>
  30.  *  
  31.  *  Copyright (c) 1998-2000 Craig Barton Upright
  32.  * 
  33.  *  All rights reserved.
  34.  * ==========================================================================
  35.  */
  36.  
  37. *** Preliminaries ;
  38.  
  39. options ls = 80 ;
  40. LIBNAME mysas v609 "." ; 
  41. FILENAME IN1 "../SPPA_82_97/82_85_92/SPPA1982" ;
  42.  
  43.  
  44. *** Value labels ;
  45.  
  46. PROC FORMAT ;
  47.  
  48. VALUE   urbrural
  49.  
  50.     1       =  " 1 Urban                                " 
  51.     2       =  " 2 Rural - Farm, 10 acres or larger     "
  52.     3       =  " 3 Rural - Farm, less than 10 acres     "
  53.     4       =  " 4 Rural - Non-Farm,10 acres or larger  "
  54.     5       =  " 5 Rural - Non-Farm, less than 10 acres " ;
  55.  
  56. VALUE   metrange
  57.  
  58.     00      =  "00  under 200                           "
  59.     01      =  "01       200 -     499                  "
  60.     02      =  "02       500 -     999                  "
  61.     03      =  "03     1,000 -   1,499                  "
  62.     04      =  "04     1,500 -   1,999                  "
  63.     05      =  "05     2,000 -   2,499                  "
  64.     06      =  "06     2,500 -   4,999                  "
  65.     07      =  "07     5,000 -   9,999                  "
  66.     08      =  "08    10,000 -  19,999                  "
  67.     09      =  "09    20,000 -  24,999                  "
  68.     10      =  "10    25,000 -  49,999                  "
  69.     11      =  "11    50,000 -  99,999                  "
  70.     12      =  "12   100,000 - 240,999                  "
  71.     13      =  "13   250,000 - 499,999                  "
  72.     14      =  "14   500,000 - 999,999                  "
  73.     15      =  "15 1,000,000 or more                    "
  74.     99      =  "99 missing value                        " ;
  75.  
  76.  
  77. VALUE   msa
  78.  
  79.     1       =  " 1 Central city of an SMSA only         "
  80.     2       =  " 2 Central city of an urbnized area only"
  81.     3       =  " 3 Central city of both SMSA, urbanized "
  82.     4       =  " 4 Other incorporated place             "
  83.     5       =  " 5 Unincorporated place                 "
  84.     7       =  " 7 Not a place                          " ;
  85.     
  86. VALUE   quartype
  87.  
  88.     01      =  "01 House, apartment, flat               "
  89.     02      =  "02 Housing unit in nontrnsient hotel etc"
  90.     03      =  "03 Housing unit, permanent in transient "
  91.     04      =  "04 Housing unit in rooming house        "
  92.     05      =  "05 Mobile home or trailer               " 
  93.     06      =  "06 Housing unit not specified above     "
  94.     07      =  "07 Quarters in rooming/boarding house   "
  95.     08      =  "08 Unit not perm in transient hotel     "
  96.     09      =  "09 Unoccupied site for mobile home, etc "
  97.     10      =  "10 Other unit not specified above       " ;
  98.     
  99. VALUE   number
  100.         
  101.      98     = " 98 residue                              "
  102.      99     =  "99 missing value                        "
  103.     998     = "998 residue                              "
  104.     999     = "999 missing value                        " ;
  105.  
  106. VALUE   phyesno
  107.  
  108.     1       =  " 1 Phone in unit - phone intrvw accp    "
  109.     2       =  " 2 Phone in unit - phone intrvw unaccp  "
  110.     3       =  " 3 Phone elsewhere - phone intrvw accp  "
  111.     4       =  " 4 Phone elsewhere - phone intrvw unaccp"
  112.     5       =  " 5 No phone                             "
  113.     8       =  " 5 residue                              "
  114.     9       =  " 9 missing value                        " ;
  115.     
  116. VALUE   incrange
  117.  
  118.     03      =  "03 Less than  $3,000                    "
  119.     05      =  "05 $ 3,000 to  4,999                    "
  120.     06      =  "06 $ 5,000 to  5,999                    "
  121.     07      =  "07 $ 6,000 to  7,499                    "
  122.     08      =  "08 $ 7,500 to  9,999                    "
  123.     09      =  "06 $10,000 to 11,999                    "
  124.     10      =  "10 $12,000 to 14,999                    "
  125.     11      =  "11 $15,000 to 19,999                    "
  126.     12      =  "12 $20,000 to 24,999                    "
  127.     13      =  "13 $25,000 to 49,999                    " 
  128.     14      =  "11 $50,000 and over                     "
  129.     98      =  "98 residue                              "
  130.     99      =  "99 missing value                        " ;
  131.     
  132.     
  133. VALUE   monthnm
  134.  
  135.     01      =  "01 January                              "
  136.     02      =  "02 February                             "
  137.     03      =  "03 March                                "
  138.     04      =  "04 April                                "
  139.     05      =  "05 May                                  "
  140.     06      =  "06 June                                 "
  141.     07      =  "07 July                                 "
  142.     08      =  "08 August                               "
  143.     09      =  "09 September                            "
  144.     10      =  "10 Ocober                               "
  145.     11      =  "11 November                             "
  146.     12      =  "12 December                             " ;
  147.  
  148. VALUE   relation
  149.  
  150.     1       =  " 1 Reference person                     "
  151.     2       =  " 2 Spouse                               "
  152.     3       =  " 3 Own child                            "
  153.     4       =  " 4 Other relative                       " 
  154.     5       =  " 5 Non-relative                         "
  155.     9       =  " 9 missing value                        " ;
  156.     
  157. VALUE   status
  158.  
  159.     1       =  " 1 Married                              "
  160.     2       =  " 2 Widowed                              "
  161.     3       =  " 3 Divorced                             "
  162.     4       =  " 4 Separated                            "
  163.     5       =  " 5 Never married                        "
  164.     8       =  " 8 residue                              "
  165.     9       =  " 9 missing value                        " ;
  166.     
  167. VALUE   rrace
  168.  
  169.     1       =  " 1 White                                "
  170.     2       =  " 2 Black                                "
  171.     3       =  " 3 Other                                " 
  172.     9       =  " 9 missing value                        " ;
  173.     
  174. VALUE   mf
  175.  
  176.     1       =  " 1 Male                                 "
  177.     2       =  " 2 Female                               "
  178.     9       =  " 9 missing value                        " ;
  179.     
  180. VALUE   noyes
  181.  
  182.     0       =  " 0 No                                   "
  183.     1       =  " 1 Yes                                  "
  184.     8       =  " 8 residue                              "
  185.     9       =  " 9 missing value                        " ;
  186.  
  187. VALUE   catnoyes
  188.  
  189.     0       =  " 0 No entry for this category           "
  190.     1       =  " 1 Entry for this category              "
  191.     8       =  " 8 NA, all categories are blank         "
  192.     9       =  " 9 missing value                        " ;
  193.     
  194. RUN ;
  195.  
  196.  
  197. *** Input data ;
  198.  
  199. DATA mysas.sppa1982 ;
  200. INFILE IN1 LRECL=660 MISSOVER ;
  201.  
  202. INPUT
  203.  
  204.     /*       Characters 1 - 120 are the household section  */
  205.  
  206.     @1       sample          2.
  207.     @3       psunumbr        3.
  208.     @6       segnumbr        4.
  209.     @10      checkdig        1.
  210.     @11      sernumbr        2.
  211.     @13      blank1          1.
  212.     @14      hhnumbr         1.
  213.     @15      Landuse         1.
  214.     @16      Metsize         2.
  215.     @18      Msatype         1.
  216.     @19      blank2          3.
  217.     @22      blank3          1.
  218.     @23      hhrsnumb        2.
  219.     @25      noninttp        1.
  220.     @26      nonintrc        1.
  221.     @27      nonintrs        2.
  222.     @29      blank4          9.
  223.     @38      hhstatus        1.
  224.     @39      spcplace        2.
  225.     @41      tenure          1.
  226.     @42      blank5          1.
  227.     @43      Lvquart         2.
  228.     @45      blank6          1.
  229.     @46      hhbusnss        1.
  230.     @47      hsgunits        2.
  231.     @49      crimrprt        2.
  232.     
  233.     /*       Characters 124 - 171 are the person section */
  234.     
  235.     @124     Refrltn         1.
  236.     @125     Age             2.
  237.     @127     MARSTAT         1.
  238.     @128     RACE            1.
  239.     @129     SEX             1.
  240.     @130     afmemb          1.
  241.     @131     GRADE           2.
  242.     @133     Gradecom        1.
  243.     @134     blank12         2.
  244.     @136     WORKWK          2.
  245.     @138     inttype2        1.
  246.     @139     blank13         5.
  247.     @144     layoff          1.
  248.     @145     blank14         1.
  249.     @146     nojobrsn        1.
  250.     @147     forwhom         1.
  251.     @148     iccode          3.
  252.     @151     emptype         1.
  253.     @152     occcode         3.
  254.     @155     blank15        11.
  255.     @166     Workwkhr        3.
  256.     @169     Ethncity        2.
  257.     @171     workwk2         1.
  258.     @172     blank16         9.
  259.     
  260.     /*       Characters 181 - 660 are the SPPA section */
  261.     
  262.     @181     blank17        18.
  263.     @199     lashhwt        12.
  264.     @211     laspnwt        12.
  265.     @223     hfsampcd       16.
  266.     @239     blank18         3.
  267.     @242     version         1.
  268.     @243     blank19        17.
  269.     @260     Intvtype        1.
  270.     @261     Chszlt06        1.
  271.     @262     Chsz0611        1.
  272.     @263     blank20         3.
  273.     @266     LPJAZZMO        1.
  274.     @267     LPCLASMO        1.
  275.     @268     LPOPERMO        1.
  276.     @269     LPMUSIMO        1.
  277.     @270     LPPLAYMO        1.
  278.     @271     LPBALLMO        1.
  279.     @272     LPGALLMO        1.
  280.     @273     PPMUSWEL        1.
  281.     @274     PPCLAPLA        1.
  282.     @275     PPJAZPLA        1.
  283.     @276     ppanypub        1.
  284.     @277     PPPLAPUB        1.
  285.     @278     PPMUSPUB        1.
  286.     @279     PPOPRSNG        1.
  287.     @280     PPBALLET        1.
  288.     @281     LPREAD          1.
  289.     @282     blank21         3.
  290.     @285     unclear1        1.
  291.     
  292.     /*   I consider questions in characters 286 thu 292 to be   */
  293.     /*   unreliable.  response rates of 100 or less.   -cbu     */
  294.     
  295.     @286     lpjazzXX        1.
  296.     @287     lpclasXX        1.
  297.     @288     lpoperXX        1.
  298.     @289     lpmusiXX        1.
  299.     @290     lpplayXX        1.
  300.     @291     lpballXX        1.
  301.     @292     lpgallXX        1.
  302.     @293     blank22         1.
  303.     @294     unclear2        1.
  304.     @295     lpprplld        1.
  305.     @296     lpprpln         2.
  306.     @298     lpprpl01        1.
  307.     @299     lpprpl02        1.
  308.     @300     lpprpl03        1.
  309.     @301     lpprpl04        1.
  310.     @302     lpprpl05        1.
  311.     @303     lpprpl06        1.
  312.     @304     lpprpl07        1.
  313.     @305     lpprpl08        1.
  314.     @306     lpprpl09        1.
  315.     @307     lpprpl10        1.
  316.     @308     lpprpl11        1.
  317.     @309     lpprpl12        1.
  318.     @310     lpprefld        1.
  319.     @311     lpprefn         1.
  320.     @312     lppref01        1.
  321.     @313     lppref02        1.
  322.     @314     lppref03        1.
  323.     @315     lppref04        1.
  324.     @316     lppref05        1.
  325.     @317     lppref06        1.
  326.     @318     lppref07        1.
  327.     @319     blank23         1. ;
  328.     
  329. LABEL
  330.  
  331.     /*      household section  */
  332.         
  333.     Landuse  =  "   -land use: rural vs urban            "
  334.     Metsize  =  "   -place size                          " 
  335.     Msatype  =  "   -place description                   "
  336.     Lvquart  =  "   -type of living quarters             "
  337.     Hhszge12 =  "   -# in household aged 12 or older     "
  338.     Hhszlt12 =  "   -# in household aged less than 12    "
  339.     Phonokay =  "   -is phone interview okay             "
  340.     INCOME   =  "H26-HH INCOME-SPECIFIC CATEGORY         "
  341.     Hhszge18 =  "   -# in household aged 18 or older     "
  342.     
  343.     /*      person section  */
  344.     
  345.     Refrltn  =  "   -relationship to reference person    "
  346.     Age      =  "   -age at time of interview            "
  347.     MARSTAT  =  "H7-MARITAL STATUS                       "
  348.     RACE     =  "H2-RACE/ETHNICITY                       "
  349.     SEX      =  "S7-RESPONDENT SEX                       "
  350.     GRADE    =  "H9-HIGHEST GRADE/YEAR OF SCHOOL         "
  351.     Gradecom =  "   -did you complete that grade         "
  352.     WORKWK   =  "H15-WORKED LAST WEEK FOR PAY OR PROFIT  "
  353.     Workwkhr =  "   -# hours worked last week            "
  354.     Ethncity =  "   -ethnicity                           "
  355.     workwk2  =  "   -worked last week recode             "
  356.     
  357.     /*      SPPA section  */
  358.     
  359.     Intvtype =  "   -interview type                      "
  360.     Chszlt06 =  "   -# of respondant's children under 6  "
  361.     Chsz0611 =  "   -# of respondant's children 6 to 11  "
  362.     LPJAZZMO =  "A2A-# TIMES WENT LIVE JAZZ LAST MO      "
  363.     LPCLASMO =  "A4A-# TIMES WENT LIVE CLASSCL LAST MO   "
  364.     LPOPERMO =  "A6A-# TIMES WENT LIVE OPERA LAST MO     "
  365.     LPMUSIMO =  "A8A-# TIMES WENT LIVE MUSICAL LAST MO   "
  366.     LPPLAYMO =  "A10A-# TIMES WENT LIVE PLAY LAST MO     "
  367.     LPBALLMO =  "A12A-# TIMES WENT LIVE BALLET LAST MO   "
  368.     LPGALLMO =  "A16A-# TIMES WENT ART MUSEUM LAST MO    "
  369.     PPMUSWEL =  "E14-CAN PERFORM FOR/WITH OTHER MUSICIANS"
  370.     PPCLAPLA =  "E19-PLAYED CLASSICAL MUSIC LAST 12 MO   "
  371.     PPJAZPLA =  "E17-PERFORMED JAZZ MUSIC LAST 12 MO     "
  372.     PPPLAPUB =  "E26-ACT IN PUBLIC PERF OF PLAY LST 12 MO"
  373.     PPMUSPUB =  "E24-SANG PUBLIC PERFORMANCE OF MUSICAL  "
  374.     PPOPRSNG =  "E21-SANG MUSIC FROM OPERA LAST 12 MO    "
  375.     PPBALLET =  "E27-DANCED BALLET LAST 12 MO            " ;
  376.  
  377. FORMAT
  378.  
  379.     Landuse         urbrural.
  380.     Metsize         metrange.
  381.     Msatype         msa.
  382.     Lvquart         quartype.
  383.     Hhszge12        number.
  384.     Hhszlt12        number.
  385.     Phonokay        phyesno.
  386.     INCOME          incrange.
  387.     Hhszge18        number.
  388.     Intvmm          monthnm.
  389.     Intvyy          number.
  390.     Refrltn         relation.
  391.     Age             number.
  392.     MARSTAT         status.
  393.     RACE            rrace.
  394.     SEX             mf.
  395.     GRADE           gradeyr.
  396.     Gradecom        yesno.
  397.     WORKWK          worksta.
  398.     Workwkhr        number.
  399.     Ethncity        ethncode.
  400.     workwk2         workstb.
  401.     Intvtype        itype.
  402.     Chszlt06        numbera.
  403.     Chsz0611        numbera.
  404.     LPJAZZMO        lpfreq.
  405.     LPCLASMO        lpfreq.
  406.     LPOPERMO        lpfreq.
  407.     LPMUSIMO        lpfreq.
  408.     LPPLAYMO        lpfreq.
  409.     LPBALLMO        lpfreq.
  410.     LPGALLMO        lpfreq.
  411.     PPMUSWEL        noyes.
  412.     PPCLAPLA        noyes.
  413.     PPJAZPLA        noyes.
  414.     ppanypub        noyes.
  415.     PPPLAPUB        noyes.
  416.     PPMUSPUB        noyes.
  417.     PPOPRSNG        noyes.
  418.     PPBALLET        noyes.
  419.     LPREAD          noyes. ;
  420.  
  421. RUN ;
  422. PROC CONTENTS ;   RUN ;